package burubaka.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2012-05-04 21:41:09")
/** */
public final class PreRaceInfoMeta extends org.slim3.datastore.ModelMeta<burubaka.model.PreRaceInfo> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo> displayRaceName = new org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo>(this, "displayRaceName", "displayRaceName");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo> districtClass = new org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo>(this, "districtClass", "districtClass");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.PreRaceInfo, java.lang.Integer> execFlag = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.PreRaceInfo, java.lang.Integer>(this, "execFlag", "execFlag", int.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.PreRaceInfo, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.PreRaceInfo, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo> raceDate = new org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo>(this, "raceDate", "raceDate");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo> raceName = new org.slim3.datastore.StringAttributeMeta<burubaka.model.PreRaceInfo>(this, "raceName", "raceName");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.PreRaceInfo, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.PreRaceInfo, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final PreRaceInfoMeta slim3_singleton = new PreRaceInfoMeta();

    /**
     * @return the singleton
     */
    public static PreRaceInfoMeta get() {
       return slim3_singleton;
    }

    /** */
    public PreRaceInfoMeta() {
        super("PreRaceInfo", burubaka.model.PreRaceInfo.class);
    }

    @Override
    public burubaka.model.PreRaceInfo entityToModel(com.google.appengine.api.datastore.Entity entity) {
        burubaka.model.PreRaceInfo model = new burubaka.model.PreRaceInfo();
        model.setDisplayRaceName((java.lang.String) entity.getProperty("displayRaceName"));
        model.setDistrictClass((java.lang.String) entity.getProperty("districtClass"));
        model.setExecFlag(longToPrimitiveInt((java.lang.Long) entity.getProperty("execFlag")));
        model.setKey(entity.getKey());
        model.setRaceDate((java.lang.String) entity.getProperty("raceDate"));
        model.setRaceName((java.lang.String) entity.getProperty("raceName"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        burubaka.model.PreRaceInfo m = (burubaka.model.PreRaceInfo) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("displayRaceName", m.getDisplayRaceName());
        entity.setProperty("districtClass", m.getDistrictClass());
        entity.setProperty("execFlag", m.getExecFlag());
        entity.setProperty("raceDate", m.getRaceDate());
        entity.setProperty("raceName", m.getRaceName());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        burubaka.model.PreRaceInfo m = (burubaka.model.PreRaceInfo) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        burubaka.model.PreRaceInfo m = (burubaka.model.PreRaceInfo) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        burubaka.model.PreRaceInfo m = (burubaka.model.PreRaceInfo) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        burubaka.model.PreRaceInfo m = (burubaka.model.PreRaceInfo) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        burubaka.model.PreRaceInfo m = (burubaka.model.PreRaceInfo) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getDisplayRaceName() != null){
            writer.setNextPropertyName("displayRaceName");
            encoder0.encode(writer, m.getDisplayRaceName());
        }
        if(m.getDistrictClass() != null){
            writer.setNextPropertyName("districtClass");
            encoder0.encode(writer, m.getDistrictClass());
        }
        writer.setNextPropertyName("execFlag");
        encoder0.encode(writer, m.getExecFlag());
        if(m.getRaceDate() != null){
            writer.setNextPropertyName("raceDate");
            encoder0.encode(writer, m.getRaceDate());
        }
        if(m.getRaceName() != null){
            writer.setNextPropertyName("raceName");
            encoder0.encode(writer, m.getRaceName());
        }
        writer.endObject();
    }

    @Override
    protected burubaka.model.PreRaceInfo jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        burubaka.model.PreRaceInfo m = new burubaka.model.PreRaceInfo();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("displayRaceName");
        m.setDisplayRaceName(decoder0.decode(reader, m.getDisplayRaceName()));
        reader = rootReader.newObjectReader("districtClass");
        m.setDistrictClass(decoder0.decode(reader, m.getDistrictClass()));
        reader = rootReader.newObjectReader("execFlag");
        m.setExecFlag(decoder0.decode(reader, m.getExecFlag()));
        reader = rootReader.newObjectReader("raceDate");
        m.setRaceDate(decoder0.decode(reader, m.getRaceDate()));
        reader = rootReader.newObjectReader("raceName");
        m.setRaceName(decoder0.decode(reader, m.getRaceName()));
        return m;
    }
}